﻿using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Auditing;
using AbpZeroTemplate.Authorization.Users;
using AbpZeroTemplate.Authorization.Users.Dto;
using AbpZeroTemplate.Web.Controllers;
using AbpZeroTemplate.Web.Swagger;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace AbpZeroTemplate.Api.Admin.Controllers
{
    /// <summary>用户登录记录
    /// </summary>
    [Area("Admin")]
    [Route("Admin/UserLogin/[action]")]
    [ApiName("Admin")]
    [RemoteService]
    [AbpMvcAuthorize]
    public class UserLoginController : AbpZeroTemplateControllerBase
    {
        private readonly IUserLoginAppService _userLoginAppService;
        /// <summary>ctor
        /// </summary>
        public UserLoginController(IUserLoginAppService userLoginAppService)
        {
            _userLoginAppService = userLoginAppService;
        }

        /// <summary>获取最近登录记录
        /// </summary>
        [HttpGet]
        [DisableAuditing]
        public async Task<ListResultDto<UserLoginAttemptDto>> GetRecentUserLoginAttempts()
        {
            return await _userLoginAppService.GetRecentUserLoginAttempts();
        }

    }
}
